package edu.zut.method;

public class MethodDemo05 {

    //多参类型
    //求和   二个数字、三个、四个.......
    public static int sum(int[] scores){
        int sum = 0;
        for(int a : scores){
            sum += a;
        }
        return sum;
    }

    //...    方法中  多参类型   默认属于数组
    public static int sum2(int... scores){
        int sum = 0;
        for (int score : scores) {
            sum += score;
        }
        return sum;
    }

    public static void main(String[] args) {
        int[] scores = {89,78,56,57,70};
        int sum = sum(scores);
        //调用多参类型方法
//        sum2(scores);
        int i = sum2(78, 56, 55, 25, 74);
        System.out.println(i);
    }



}
